package com.cac.demo.dao.materialReceive;

import com.cac.demo.entity.materialScan.WmsDeliverPlanDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Mapper
@Repository
public interface WmsItemInventoryDao {

    //台账新增
    public int insertWmsItemInventory(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO, @Param("id") String id, @Param("date") Date date, @Param("departid") String departid, @Param("account") String account);

    //增加台账数量
    public int updateWmsItemInventory(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO, @Param("workbinCode") String workbinCode);

    //查询台账id
    public HashMap searchItemInventory(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO);
    //修改库存表
    public int updateInventory(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO, @Param("workbinCode") String workbinCode, @Param("wmsItemInventoryId") String wmsItemInventoryId);

    //修改库存表
    public int updateDlivery(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO);

    //全部入库物料更改状态
    public int updateDeliveryStatus(@Param("bean")WmsDeliverPlanDTO wmsDeliverPlanDTO);

    //根据质量编号查询
    public String searchWmsItemInventoryIdByQualityCode(String qualityCode);

    //物料入库时，大件货物插入大件区货架表
    public int insertLocator(@Param("map")HashMap map);

    //分拣操作后，编辑台账表占用信息
    public int updateOccupy(@Param("map")HashMap map);
    //yebo 新增判断台账是否存在占用信息
    String searchCurInventoryExistsAlloment(@Param("map")HashMap map);

    //2023-03-06 yebo 物料入库时，插入库存事务流水信息
    int insertWmsItemTransaction(@Param("bean") WmsDeliverPlanDTO wmsDeliverPlanDTO,
                                 @Param("WmsItemInventoryId") String WmsItemInventoryId,
                                 @Param("WmsInvInBillHId") String WmsInvInBillHId);
    //2023-04-18 yebo 物料入库界面，回退交接单状态功能
    int deleteWorkbinReceDetail(@Param("map") HashMap map);
    //2023-04-18 yebo 物料入库界面，回退交接单状态功能
    int insertWorkbinReceDetailDel(@Param("map") HashMap map);
    //2023-04-18 yebo 物料入库界面，回退交接单状态功能
    int updateDeliveryPlanStatus(@Param("map") HashMap map);
    //查询接收台的缓存箱
    List<HashMap> queryReceiveGkLog(@Param("ip") String ip);
    //查询交接单是否生成台账
    int queryDeliveryExistsInventory(@Param("map") HashMap map);
    //查询rece_detail和交接单中该箱号为N的状态
    List<HashMap> queryReceDetail(@Param("map") HashMap map, @Param("IP") String ip);
    //查询func
    String searchFunc(@Param("wmsDeliveryPlanId") String wmsDeliveryPlanId);

    //查询是否存在出库流水
    int searchTransaction(@Param("wmsItemInventoryId") String wmsItemInventoryId, @Param("wmsDeliveryPlanId") String wmsDeliveryPlanId);
    //查询占用id，合格证
    HashMap searchAllotId(String wmsItemInventoryId,String wmsDeliveryPlanId);

    //查询当前库存剩余数量
    int searchCurrentQty(String wmsItemInventoryId);

    //修改漏扫的物料
    int updateWmsDeliveryPlanStatus(String workbinCode);
}
